var express = require('express');
var router = express.Router();
var comment = require('../models/comment');

//获取相关电影的评论
router.post('/comment', function (req, res) {
    if (req.body.id) {
        comment.findByMovieId(req.body.id, function (err, getComment) {
            res.json({status: 0, message: '获取成功', data: getComment})
        })

    } else {
        res.json({status: 1, message: '获取失败'})
    }
});

//获取一个电影的评论
router.post('/getMovieComment', function (req, res) {
    if (req.body.id) {
        comment.findByMovieId(req.body.id, function (err, allComment) {
            res.json({status: 0, message: '获取成功', data: allComment})
        })
    } else {
        res.json({status: 1, message: '获取失败'})
    }
});

module.exports = router;

